<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8"/>
        <meta content="ie=edge" http-equiv="X-UA-Compatible"/>
        <title>
            推文预览
        </title>
        <link href="http://test.xinwei.com:88/css/common/base.css" rel="stylesheet">
            <link href="http://test.xinwei.com:88/css/common/common.css" rel="stylesheet">
                <link href="http://test.xinwei.com:88/css/common/bootstrap.min.css" rel="stylesheet">
                    <link href="http://test.xinwei.com:88/css/common/daterangepicker-bs3.css" rel="stylesheet">
                        <link href="http://test.xinwei.com:88/css/PassList.css" rel="stylesheet">
                            <script src="http://test.xinwei.com:88/js/jquery-2.1.1.min.js" type="text/javascript">
                            </script>
                            <script src="http://test.xinwei.com:88/js/bootstrap.min.js" type="text/javascript">
                            </script>
                            <script src="http://test.xinwei.com:88/js/extendPagination.js" type="text/javascript">
                            </script>
                            <script src="http://test.xinwei.com:88/js/moment.js" type="text/javascript">
                            </script>
                            <script src="http://test.xinwei.com:88/js/daterangepicker.js" type="text/javascript">
                            </script>
                            <script src="http://test.xinwei.com:88/js/clipboard.min.js" type="text/javascript">
                            </script>
                        </link>
                    </link>
                </link>
            </link>
        </link>
    </head>
    <body>
        <section class="section">
            <ul class="twyl_ul">
                <li class="twyl_teile_li">
                    <textarea class="twyl_teile" spellcheck="false">
                        {title}
                    </textarea>
                </li>
                <li class="twyl_teile_img">
                    <img src="{img_src}">
                    </img>
                </li>
                <li class="twyl_teile_center" id="twyl_teile_center">
                <pre><p>
                       {content}
                    </p></pre>
                </li>
                <li class="twyl_teile_LJ">
                    原文链接：
                    <textarea class="twyl_teiles" spellcheck="false">
                        www.baidu.com
                    </textarea>
                </li>
            </ul>
            <footer>
                <ul class="footer_ul">
                    <li class="footer_ul_li1">
                        （正常复制粘贴）
                    </li>
                    <li class="footer_ul_li2">
                        <k class="footer_ul_li_k">
                            1
                        </k>
                        <span class="footer_ul_wz">
                            复制文字标题
                        </span>
                    </li>
                    <li class="footer_ul_li2">
                        <k class="footer_ul_li_k footer_ul_li_kTow">
                            2
                        </k>
                        <span class="footer_ul_Nr">
                            复制文章内容
                        </span>
                    </li>
                    <li class="footer_ul_li2">
                        <k class="footer_ul_li_k">
                            3
                        </k>
                        <span class="footer_ul_Lj">
                            复制原文链接
                        </span>
                    </li>
                </ul>
            </footer>
        </section>
        <div class="bonbeijing_FZ">
            复制成功
        </div>
    </body>
</html>
<script>
    function Copy(Name){
			var Url2=Name;
				Url2.select(); // 选择对象
				document.execCommand("Copy"); // 执行浏览器复制命令				
				$(".bonbeijing_FZ").fadeIn() 
				setTimeout(function(){
					$(".bonbeijing_FZ").fadeOut()
				},800);
	}

		$(".footer_ul_wz").click(function(){
			$(this).prev().removeClass("footer_ul_li_k")
			Copy( $(".twyl_teile") )
		})

		$(".footer_ul_Lj").click(function(){
			$(this).prev().removeClass("footer_ul_li_k")
			Copy( $(".twyl_teiles"))
		})

			var _p = document.getElementsByTagName("p") 
			var Text = ""
			for(var i=0;i<_p.length;i++){
				Text+=_p[i].innerText
			}
			
			var clipboard = new Clipboard('.footer_ul_Nr', {
		        text: function() {
		            return Text;
		        }
		    });
		
		    clipboard.on('success', function(e) {
		        console.log("成功");
		        $(".footer_ul_li_kTow").removeClass("footer_ul_li_k")
		        $(".bonbeijing_FZ").fadeIn() 
				setTimeout(function(){
					$(".bonbeijing_FZ").fadeOut()
				},800);
		    });
		
		    clipboard.on('error', function(e) {
		       	alert("失败请手动复制!")
		    });
</script>
